<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        class Father {
            constructor(firstName, skill) {
                // console.log(firstName, skill);
                this.firstName = firstName
                this.skill = skill
            }

            money () {
                console.log('通过' + this.skill + '赚钱');
            }
        }

        class Son extends Father {
            constructor(x, y, z) {
                //super作为函数调用，调用父类的constructor
                super(x, y)
                //添加子类自己的属性
                this.z = z
                super.money()
            }

            exam () {
                console.log('考了71.1分');
            }
        }

        // const father = new Father('despot', '前端开发')
        // console.log(father);
        // father.money()
        // father.exam()
        const son = new Son('despot', '前端开发', '男')

        // console.log(son);
        // son.money()
        // son.exam()

    </script>
</body>

</html>